package com.androidx.p013lv.mine.dialog;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.Spannable;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.URLSpan;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import com.androidx.p013lv.base.bean.NoticeBean;
import com.androidx.p013lv.mine.C1207R;

/* renamed from: com.androidx.lv.mine.dialog.NoticeDialog */
public class NoticeDialog extends Dialog {
    private String content;
    private TextView textView = ((TextView) findViewById(C1207R.C1210id.dialog_notice_content));

    public NoticeDialog(Context context, final NoticeBean noticeBean) {
        super(context, C1207R.C1214style.ForceUpdateAppDialog);
        setContentView(C1207R.C1212layout.dialog_notice_layout);
        this.content = noticeBean.getContent();
        Window window = getWindow();
        WindowManager.LayoutParams attributes = window.getAttributes();
        attributes.gravity = 17;
        window.setAttributes(attributes);
        setCancelable(true);
        setCanceledOnTouchOutside(true);
        ((TextView) findViewById(C1207R.C1210id.dialog_notice_confirm_btn)).setOnClickListener(new View.OnClickListener() {
            /* class com.androidx.p013lv.mine.dialog.NoticeDialog.View$OnClickListenerC13031 */

            public void onClick(View view) {
                NoticeDialog.this.dismiss();
            }
        });
        ((TextView) findViewById(C1207R.C1210id.dialog_notice_app)).setOnClickListener(new View.OnClickListener() {
            /* class com.androidx.p013lv.mine.dialog.NoticeDialog.View$OnClickListenerC13042 */

            public void onClick(View view) {
                String appCenterUrl = noticeBean.getAppCenterUrl();
                if (!TextUtils.isEmpty(appCenterUrl)) {
                    Intent intent = new Intent();
                    intent.setAction("android.intent.action.VIEW");
                    intent.setData(Uri.parse(appCenterUrl));
                    NoticeDialog.this.getContext().startActivity(intent);
                    NoticeDialog.this.dismiss();
                }
            }
        });
        if (TextUtils.isEmpty(this.content)) {
            dismiss();
            return;
        }
        this.textView.setText(this.content);
        stripUnderlines(this.textView);
    }

    private void stripUnderlines(TextView textView2) {
        if (textView2 != null && (textView2.getText() instanceof Spannable)) {
            Spannable spannable = (Spannable) textView2.getText();
            URLSpan[] uRLSpanArr = (URLSpan[]) spannable.getSpans(0, spannable.length(), URLSpan.class);
            for (URLSpan uRLSpan : uRLSpanArr) {
                int spanStart = spannable.getSpanStart(uRLSpan);
                int spanEnd = spannable.getSpanEnd(uRLSpan);
                spannable.removeSpan(uRLSpan);
                spannable.setSpan(new URLSpanNoUnderline(uRLSpan.getURL()), spanStart, spanEnd, 0);
            }
            textView2.setAutoLinkMask(0);
            textView2.setText(spannable);
            textView2.setMovementMethod(LinkMovementMethod.getInstance());
        }
    }

    /* access modifiers changed from: private */
    /* renamed from: com.androidx.lv.mine.dialog.NoticeDialog$URLSpanNoUnderline */
    public static class URLSpanNoUnderline extends URLSpan {
        static final /* synthetic */ boolean $assertionsDisabled = false;

        URLSpanNoUnderline(String str) {
            super(str);
        }

        public void updateDrawState(TextPaint textPaint) {
            super.updateDrawState(textPaint);
            textPaint.setUnderlineText(false);
        }
    }
}
